$font: 'ubuntu', 'lucida grande';

@import 'theme';
@import 'highlight';

$in_group_row_spacing: 40px;

@mixin table-base {
  border-collapse: collapse;

  td {
    padding-right: 30px;
    padding-bottom: 5px;
    padding-top: 5px;
    vertical-align: top;
  }

  td:last-child {
    padding-right: 0px;
  }

  td:empty {
    padding-right: 0px;
  }

  tr:last-child td {
    padding-bottom: 0px;
  }
}

@mixin table-items {
  @include table-base;

  margin-left: 30px;
  margin-bottom: $in_group_row_spacing;

  td.identifier {
    font-weight: normal;
  }

  tr:last-child td {
    padding-bottom: 5px;
  }
}

@mixin table-alt {
  tr:nth-child(even) {
    background-color: #f9f9f9;
  }

  tr.selected {
      background-color: $selection_color;
  }
}

@mixin inline-doc {
  div.brief, div.doc, div.fulldoc {
    background: transparent;
    margin: 0px;
    padding: 0px;
  }
}

#cldoc, #cldoc #cldoc_sidebar_items {
  &::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }

  &::-webkit-scrollbar-track {
    background-color: $scrollbar_bg_color;
    margin: 2px;
    border-radius: 5px;
  }

  &::-webkit-scrollbar-thumb {
    background-color: $scrollbar_color;
    margin: 2px;
    border-radius: 5px;
  }

  &.hide_scrollbar {
    &::-webkit-scrollbar-track, &::-webkit-scrollbar-thumb {
      background-color: $sidebar_bg_color;
    }

    overflow-y: hidden;
  }
}

#cldoc {
  font-family: $font;

  .selected {
    background-color: $selection_color;
  }

  .builtin {
    color: $builtin_color;
  }

  .keyword {
    color: $keyword_color;
    font-weight: bold;
  }

  .preprocessor {
    color: $preprocessor_color;
  }

  .comment {
    color: $comment_color;
  }

  .identifier {
    color: $identifier_color;
  }

  h1, h2, h3, h4, h5, h6 {
    color: $header_color;
    padding-bottom: 3px;
  }

  h1, h2 {
    border-bottom: 1px solid lighten($header_color, 50%);
  }

  h3, h4, h5, h6 {
    margin-bottom: 0px;
  }

  h1 {
    border: 0;
    margin-top: 0px;
    text-shadow: 1px 1px lighten($header_color, 60%);

    span.keyword {
      padding-right: 20px;
    }
  }

  h2 {
    margin-top: 60px;
  }

  a {
    cursor: hand;
    text-decoration: underline;
    color: #0876c8;
  }

  div.brief p:first-child, div.doc p:first-child {
    padding-top: 0px;
    margin-top: 0px;
  }

  div.brief p:last-child, div.doc p:last-child {
    padding-bottom: 0px;
    margin-bottom: 0px;
  }

  #cldoc_sidebar_bg {
    overflow: none;
    width: $sidebar_width;
    background-color: $sidebar_bg_color;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
  }

  #cldoc_sidebar {
    width: $sidebar_width;
    background-color: $sidebar_bg_color;
    border-right: 1px solid $scrollbar_bg_color;

    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
  }

  #cldoc_sidebar.search {
    #cldoc_sidebar_items {
      display: none;
    }
  }

  #cldoc_sidebar_items {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 2.5em;
    width: $sidebar_width - 10px;
    padding: 5px;

    overflow: auto;
    overflow-y: scroll;

    div.back {
      .arrow {
        padding-right: 5px;
      }

      div.name {
        padding-bottom: 5px;

        span.keyword {
          padding-right: 5px;
          font-weight: normal;
        }
      }

      a {
        display: block;
        margin-left: 10px;
      }
    }

   .subtitle {
      font-size: 1.1em;
      text-align: center;
      margin-top: 15px;

      text-shadow: 1px 1px #eee;
      color: #333;
    }

    #cldoc_sidebar_pagenav {
      margin-top: 15px;
    }

    #cldoc_sidebar_pagenav:empty {
      margin-top: 0px;
    }

    ol, ul {
      margin: 0;
      padding: 0;
      padding-left: 10px;
      font-size: 0.9em;
      margin-top: 5px;
    }

    ul {
      list-style: none;
    }

    * {
        text-overflow: ellipsis;
    }

    li {
      padding-bottom: 2px;
      padding-top: 2px;
      text-overflow: ellipsis;
      overflow: hidden;
      white-space: nowrap;
    }

    span.counter {
      padding: 2px 4px 2px 4px;
      margin-left: 5px;
      font-size: 0.6em;
      vertical-align: super;
      background-color: #4298d8;
      color: #fff;
      display: none;
      border-radius: 10px;
      min-width: 10px;
      text-align: center;
    }

    span.virtual, span.protected, span.static {
      font-size: 0.6em;
      min-width: 1.6em;
      display: inline-block;
      vertical-align: super;
      text-align: center;
      background-color: $keyword_color;
      color: #fff;
      margin-left: 5px;
      padding-bottom: 2px;
    }

    .brief {
      text-shadow: none;
      font-size: 0.9em;
      white-space: nowrap;
      text-overflow: ellipsis;
      overflow: hidden;
      padding: 2px;
      margin: 0px;
      margin-bottom: 3px;
      color: #999;
    }

    span.bullet {
      font-weight: bold;
      padding-right: 5px;
    }

    span.bullet.complete {
      color: $solarized_green;
    }

    span.bullet.incomplete {
      color: $solarized_red;
    }

    a {
      text-decoration: none;
    }
  }

  #cldoc_search {
    position: fixed;
    bottom: 0.5em;
    width: $sidebar_width - 27px;
    left: 8px;
    height: 1.2em;
    padding: 2px 5px 2px 5px;
    border: 1px solid #aaa;
    background-color: #fafafa;
  }

  #cldoc_search.focus {
    border: 1px solid $solarized_blue;
  }

  #cldoc_search input {
    padding: 0;
    margin: 0;
    top: 3px;
    right: 18px;
    left: 20px;
    position: absolute;
    border: 0;
    background-color: transparent;
  }

  #cldoc_search input:focus {
    outline-style: none;
  }

  #cldoc_search {
    div.icon, div.close {
      width: 16px;
      height: 16px;
      position: absolute;
      top: 3px;
      z-index: 2;
      cursor: pointer;
    }

    div.icon.focus, div.close.focus {
      background-position: 100% 0%;
    }
  }

  #cldoc_search div.icon {
    left: 2px;

    background-image: url('');
  }

  #cldoc_search div.close {
    right: 2px;
    background-image: url('');
  }

  #cldoc_content {
    margin-left: $sidebar_width + 20px;
    padding: 10px;
    padding-left: 20px;

    div.fulldoc div.brief {
      margin: 0px;
      margin-bottom: 10px;
      padding: 0px;
    }

    div.fulldoc div.doc {
      margin: 0px;
      padding: 0px;
    }

    div.doc table td, div.doc table th {
      padding: 0px 5px 0px 5px;
    }

    div.brief, div.doc, div.fulldoc {
      margin-left: 10px;
      color: #666;
      padding: 5px;
      margin-top: 2px;
      margin-bottom: 15px;
      font-size: 0.9em;
      background-color: #eee;
    }

    span.type .keyword {
      font-weight: normal;
    }

    span.constant {
      color: #a0a;
    }

    div.structures, div.classes {
      div.item {
        margin-bottom: 30px;
      }
    }

    table.typedefs {
      @include table-base;
    }

    table.search_results {
      @include table-base;

      span.search_result {
        background-color: $selection_color;
      }
    }

    div.enumerations {
      table {
        @include table-items;
        @include inline-doc;
        @include table-alt;
      }
    }

    ul.gobject_property_mode {
      list-style-type: none;
      margin: 0;
      padding: 0;

      li {
        float: left;
      }

      li:after {
        content: ", ";
      }

      li:last-child:after {
        content: "";
      }
    }

    table.category, table.namespace, table.fields, table.variables,
    table.arguments, table.bases, table.implements, table.subclasses, table.implemented_by,
    table.template_parameters, table.function-template-parameters, table.structures, table.gobject_classes, table.classes,
    table.gobject_boxed_structures, table.gobject_properties, table.gobject_interfaces {
      @include table-items;
      @include inline-doc;
      @include table-alt;

      .keyword {
        font-weight: normal;
      }

      tr.union td {
        padding-top: 15px;
      }

      tr.full > td {
        padding-top: 15px;
      }
    }

    table.union td {
      padding-top: 0px;
      padding-bottom: 0px;
      font-size: 0.9em;
    }

    table.category, table.namespace {
      margin-bottom: 10px;
    }

    div.structures, div.classes {
      table {
        border-left: 1px solid #999;

        td {
          padding-left: 10px;
        }
      }
    }

    div.enumerations {
      table {
        td.value {
          text-align: right;
        }
      }
    }

    div.function {
      margin-bottom: 50px;

      div.declaration {
          background-color: lighten(#729fcf, 35%);
          border: 1px solid lighten(#729fcf, 20%);
          padding: 5px;
      }

      div.declaration.selected {
        background-color: $selection_color;
        border: 1px solid darken($selection_color, 40%);
      }

      table.declaration {
        @include table-base;

        td {
          padding: 0px;
          padding-right: 5px;
        }

        td.identifier {
          padding-right: 30px;
        }

        td.close_paren {
          padding: 0px;
        }

        td.open_paren {
          padding-right: 1px;
        }

        td.argument_name {
          text-align: left;
          padding-right: 1px;
        }

        td.argument_type {
          padding-right: 2px;
          span.type {
            display: block;

            span.name {
              float: left;
              margin-right: 10px;
            }

            span.function-arguments > span.sub-type > span.name:last-child {
              margin-right: 0;
            }

            span.plain, span.function-qualified, span.sub-type {
              float: left;
            }

            span.qualifier {
              float: right;
            }

            span.function-qualified span.qualifier,
            span.function-qualified span.plain {
              float: none;
            }
          }
        }
      }

      div.overrides {
        margin-top: 10px;
        font-size: 0.8em;

        span.title {
          color: $keyword_color;
          padding-right: 10px;
        }

        a {
          color: lighten($link_color, 10%);
        }
      }

      table.arguments, table.function-template-parameters {
        td {
          font-size: 0.9em;
        }

        div.doc, div.brief, div.fulldoc {
          font-size: 1em;
        }

        div.doc {
          display: inline-block;
        }

        tr.return {
          background: transparent;

          td {
            padding-top: 15px;
          }
        }

        span.annotation {
          padding-left: 10px;
          font-size: 0.9em;
          color: $comment_color;
        }

        margin-bottom: 10px;
      }

      div.doc, div.fulldoc, div.brief {
        background: transparent;
        margin-bottom: 0px;
      }

      div.return_type {
        padding-bottom: 5px;
      }

      ul.specifiers {
        list-style-type: none;
        margin: 0;
        padding: 0;
        float: left;
        padding-top: 0.05em;

        li {
          display: inline;
          padding-right: 5px;
          color: $keyword_color;
          font-size: 0.9em;
        }

        li:last-child {
          padding-right: 10px;
        }
      }
    }

    table.undocumented {
      @include table-base;
      font-size: 0.8em;
    }

    div.arguments {
      table.function {
        @include table-base;
        font-size: 0.8em;

        tr.title {
        }

        tr.last td {
          padding-bottom: 40px;
        }

        tr.undocumented td, tr.misspelled td {
          font-size: 0.9em;
          color: lighten(#333, 10%);
        }

        span.undocumented, span.misspelled {
          padding-left: 5px;
        }

        span.undocumented:first-of-type, span.misspelled:first-of-type {
          padding-left: 0px;
        }
      }
    }

    table.references {
      @include table-base;
      font-size: 0.8em;

      tr.last td {
        padding-bottom: 40px;
      }

      tr.missing td {
        font-size: 0.9em;
        color: lighten(#333, 10%);
      }
    }

    a.know_more {
      padding-left: 15px;
      font-size: 0.9em;
    }

    div.description {
      @include inline-doc;
    }

    img[alt*=centered] {
      display: block;
      margin: 0 auto;
    }
  }
}

/* vi:ts=2:et */
